TUTORIAL MX 2004+ complaint, uses symbols and you should also know how to use simple frame actions explained here
Hey, this has been asked several times before so I figured I'll explain it this will cover simple AS used to create animated buttons that play an animation when you roll out of them, and one when you press them
for starters, use a movieclip insead of a button, this is because movieclips let us manipulate frames better then buttons
create 4 frames in this movieclip you have created:
frame 1 is a static image containing how the button looks when there is nothing associated with it happening
frame 2 is an animation (movieclip) of it when you rollOver it, (like "over" in buttons)
frame 3 is an animation (movieclip) of it when you rollOut (this is the part buttons don't have)
frame 4 is an animation of it when you press it (like "down" in buttons)
after all your animations is set, go to the animation in frame 2 (the "over") and on it's last frame put the following actions:
stop();
this is to stop it from constantly playing, repeat this process for the animation in frame 4
now go to the animation in frame 3 (the "rollOut" part) and go to the last frame, put these actions in it:
_parent.gotoAndStop(1);
then give it (the main movieclip) these actions
onClipEvent(load){
stop();
}
on(rollOver){
gotoAndStop(2);
}
on(rollOut){
gotoAndStop(2);
}
on(press){
gotoAndStop(4);
}
hope this helped :)